package com.wanxi.shop.api.feign;

import com.wanxi.shop.api.query.NearShopQuery;
import com.wanxi.shop.api.result.CommonResult;
import com.wanxi.shop.api.vo.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author jinf
 * @date 2021/1/10
 * @description 店铺用于feign调用的功能
 */
@FeignClient(value = "shop-server")
public interface ShopFeignClient {

    /**
     * @author jinfang
     * @description // 根据店铺id查询店铺名称
     * @date  2021/1/14
     * @params id
     * @return CommonResult
     **/
    @GetMapping("shop/findShopNameById")
    CommonResult<String> findShopNameById(@RequestParam("id") Long id);

    /**
     * @author jinfang
     * @description // 店家根据id查看自己的店铺信息
     * @date  2021/1/14
     * @params id
     * @return CommonResult
     **/
    @GetMapping("shop/findShopById")
    CommonResult<ShopFindByIdOutVo> findShopById(@RequestParam("id") Long id);

    /**
     * @author jinfang
     * @description 店家根据id修改自己的店铺信息
     * @date  2021/1/14
     * @params id
     * @return CommonResult
     **/
    @PutMapping("shop/updateShopById")
    CommonResult updateShop(@RequestBody ShopUpdateInVo shopUpdateInVo);


    /**
     * @author jinfang
     * @description 用户查询自己几公里范围内的店铺
     * @date  2021/1/15
     * @param nearShopQuery
     * @return
     */
    @GetMapping("user/findNearShop")
    CommonResult<List<FindNearShopOutVO>> findNearShop(@RequestBody NearShopQuery nearShopQuery);

    /**
     * @author jinfang
     * @description 用户根据店铺名字查询店铺
     * @date  2021/1/17
     * @param shopName
     * @return
     */
    @GetMapping("user/findShopName")
    CommonResult<List<FindShopNameOutVO>> findShopName(@RequestParam("shopName") String shopName);

    @GetMapping("user/findSkuByType")
    CommonResult<List<SkuFindAllOutVo>> findSkuByType(@RequestParam("typeId") Long typeId);

    @GetMapping("user/findSkuByShopId")
    CommonResult<List<SkuFindByShopOutVo>> findSkuByShopId(@RequestParam("shopId") Long shopId);

    @GetMapping("user/findAllShop")
    CommonResult<List<FindShopAll>> findAllShop(@RequestParam("ShopId") Long shopId);
}
